package com.cloudbroker.bsc.common.search.core;

import com.cloudbroker.bsc.common.search.elasticsearch.AbstractElasticsearch;
import com.cloudbroker.bsc.common.search.elasticsearch.ElasticsearchAdapter;

/**
 * 搜所引擎工厂类（可现实多种引擎）
 *
 * @create 2016-6-11
 * @author moyin18602
 * @version
 */
public class SearchEngineFactory {
	private static SearchEngineBase searchEngine;
	
	/**
	 * 1:ElasticsearchEntity
	 * @return
	 */
	public static int getType() {
		return 1;
	}
	
	/**
	 * 初始工厂
	 */
	static {
		switch (getType()) {
		case 1:
			if(searchEngine == null){
				synchronized (AbstractElasticsearch.class) {
	            	if(searchEngine == null){
	            		searchEngine = new ElasticsearchAdapter();
	            	}
	            }
			}
		default:
		}
	}
	
	public SearchEngineBase getSearchEngine(){
		return searchEngine;
	}
}
